/*
 * Childs.java
 *
 * Copyright 2011 Anish
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 *     
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.aosp.nanoxstream.utils;

import java.util.Vector;

import com.aosp.nanoxstream.Field;
import com.aosp.nanoxstream.XMLStreamProvider;

/**
 * 
 * <code>Childs.java</code>
 * <p> </p>
 * @author Anish , anishkumar.ka@gmail.com
 * <dt><b>Date: </b><dd>Jan 6, 2011
 * <dt><b>Module: </b><dd>nanoxstream-testclient
 * <dt><b>Package: </b><dd>com.aosp.nanoxstream.utils
 * <dt>TODO:<dd>
 */
public class Childs implements XMLStreamProvider{
	
	private Vector childs = new Vector();
	
	/**
	 * 
	 */
	public Childs() {
		// TODO Auto-generated constructor stub
	}

	/*
	 * (non-Javadoc)
	 * @see com.aosp.xmlparser.XMLStreamProvider#getDeclaredFields()
	 */
	public Vector getDeclaredFields() {
		Vector fields = new Vector();
		fields.addElement(new Field("childs"));
		return fields;
	}

	/*
	 * (non-Javadoc)
	 * @see com.aosp.xmlparser.XMLStreamProvider#getFieldValue(java.lang.String)
	 */
	public Object getFieldValue(String fieldName) {
		if(fieldName.equalsIgnoreCase("childs"))
			return childs;
		return null;
	}

	/*
	 * (non-Javadoc)
	 * @see com.aosp.xmlparser.XMLStreamProvider#setFieldValue(java.lang.String, java.lang.Object)
	 */
	public void setFieldValue(String fieldName, Object newValue) {
		if(fieldName.equalsIgnoreCase("childs") || fieldName.equalsIgnoreCase(String.class.getName()))
			childs.addElement((String) newValue);
	}

	public Vector getChilds() {
		return childs;
	}
}
